('t7 sub' + os.extsep + 'py', "print 'THIS SHOULD NOT BE PRINTED (sub" + os.extsep + "py)'"),
('t7 sub', None),
('t7 sub __init__' + os.extsep + 'py', ''),
('t7 sub subsub' + os.extsep + 'py', "print 'THIS SHOULD NOT BE PRINTED (subsub" + os.extsep + "py)'"),
('t7 sub subsub', None),
('t7 sub subsub __init__' + os.extsep + 'py', "print __name__, 'loading'; spam = 1")], '\nt7, sub, subsub = None, None, None\nimport t7 as tas\nprint fixdir(dir(tas))\nverify(not t7)\nfrom t7 import sub as subpar\nprint fixdir(dir(subpar))\nverify(not t7 and not sub)\nfrom t7.sub import subsub as subsubsub\nprint fixdir(dir(subsubsub))\nverify(not t7 and not sub and not subsub)\nfrom t7.sub.subsub import spam as ham\nprint "t7.sub.subsub.spam =", ham\nverify(not t7 and not sub and not subsub)\n')]
nontests = [
('x5', [], 'import a' + '.a' * 400),
('x6', [], 'import a' + '.a' * 499),
('x7', [], 'import a' + '.a' * 500),
('x8', [], 'import a' + '.a' * 1100),
('x9', [], 'import ' + 'a' * 400),
('x10', [], 'import ' + 'a' * 500),
('x11', [], 'import ' + 'a' * 998),
('x12', [], 'import ' + 'a' * 999),
('x13', [], 'import ' + 'a' * 999),
('x14', [], 'import ' + 'a' * 2000)]
args = []
if __name__ == '__main__':
args = sys.argv[1:]
if args and args[0] == '-q':
verbose = 0
del args[0]
for name, hier, code in tests:
if args and name not in args:
print 'skipping test', name
continue
print 'running test', name
runtest(hier, code)
import sys
import imp
try:
import sys.imp as sys
except ImportError:
pass
raise TestFailed, "No ImportError exception on 'import sys.imp'"